package com.fancy.application.sys.auth.Interceptor;

import com.fancy.application.sys.permission.service.ISysPermissionMatcher;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Component;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.HandlerInterceptor;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@Log4j2
@Component("sysAuthUrlInterceptor")
public class SysAuthUrlInterceptor implements HandlerInterceptor {

    @Resource
    private ISysPermissionMatcher sysPermissionMatcher;

    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        //Boolean flag = sysPermissionMatcher.doMatch(request.getRequestURI(),request.getMethod());
        //log.debug("flag,{}",flag);
//        HandlerMethod handlerMethod = (HandlerMethod) handler;
//        log.debug("handlerMethod:{}",handlerMethod);
//        log.debug("method:{}",handlerMethod.getMethod());
//        log.debug("bean:{}",handlerMethod.getBean().toString());
        return true;
    }
}
